package com.example.fw;

import java.io.IOException;
import java.util.Properties;

public class AppManager {

	private Properties props;
	private ProcessHelper processHelper;
	private ContactHelper contactHelper;
	private AutoItHelper autoItHelper;
  
    public AppManager(Properties properties){
		this.props = properties;
    }
	
    public void start() throws IOException {
    	getProcessHelper().startAppUnderTest();
	}

    public void stop() { 
    	getProcessHelper().stopAppUnderTest();
	}

	public void setProperties(Properties props){
		this.props = props;
	}
	
	public String getProperty(String key){
		return props.getProperty(key);
	}
	
	public String getProperty(String key, String defaultValue){
		return props.getProperty(key, defaultValue);
	}
	
	public ProcessHelper getProcessHelper() {
		if (processHelper == null) {
			processHelper = new ProcessHelper(this);
		}
		return processHelper;
	}

	public ContactHelper getContactHelper() {
		if (contactHelper == null) {
			contactHelper = new ContactHelper(this);
		}
		return contactHelper;
	}

	public AutoItHelper getAutoItHelper() {
		if (autoItHelper == null) {
			autoItHelper = new AutoItHelper(this);
		}
		return autoItHelper;
	}

}
